import request from "@/api/request";

export default {
    // 获得考生的所有考试
    getUserExam: (param, token) => {
        return request({
            url: '/exam/user/page',
            method: 'post',
            headers: {'token': token},
            data: param
        })
    },
    // 考生进入考试
    userEnterExam: (param, token) => {
        return request({
            url: '/exam/user/enter',
            method: 'get',
            headers: {'token': token},
            params: {
                examId: param
            }
        })
    },
//    学生暂存代码
    userStagExam: (param, token) => {
        console.log("params",param)
        return request({
            url: '/exam/user/staging',
            method: 'post',
            headers: {'token': token},
            data: param

        })
    },
//    学生提交代码
    userSubmitExam: (param, token) => {
        return request({
            url: '/exam/user/submit',
            method: 'post',
            headers: {'token': token},
            data: param
        })
    },
//    获取用户提交后的答案
    userGetExamAmser: (param, token) => {
        return request({
            url: '/exam/user/get/ans',
            method: 'get',
            headers: {'token': token},
            params: {
                examId: param
            }
        })
    },
    // 获取暂存区的答案
    userGetStagExamAnser: (param, token) => {
        return request({
            url: '/exam/user/get/staging-ans',
            method: 'get',
            headers: {'token': token},
            params: {
                examId: param
            }
        })
    },
    // 获取班级信息
    getClassInfo: (param, token) => {
        return request({
            url: '/exam/class/get',
            method: 'get',
            headers: {'token': token},
            params: {
                classId: param
            }
        })
    },
    // 获取班级信息
    userSubmitLog: (param, token) => {
        return request({
            url: '/exam/user/submit-log',
            method: 'post',
            headers: {'token': token},
            data: param

        })
    },
    // 上传图片
    uploadImage: (params, token) => {
        let file = new File([params], 'example.png');
        let formData = new FormData();
        formData.append('file', file);
        return request({
            url: '/common/upload',
            method: 'post',
            headers: {'token': token,
                'Content-Type': 'multipart/form-data'
            },
            data: formData,
            params: {
                use: "V",
                problemId: 10086999
            }

        })
    },
    // 截图信息上传
    userScreenshot: (param, token) => {
        return request({
            url: '/exam/user/screenshot/upload',
            method: 'post',
            headers: {'token': token},
            data: param

        })
    },
    // 截图信息上传
    userBehavior: (param, token) => {
        return request({
            url: '/exam/user/behavior',
            method: 'post',
            headers: {'token': token},
            data: param

        })
    },
    questionSubmit:(param,token)=>{
        return request({
            url:"/exam/user/submit-evaluation",
            // url: 'submission/create',
            method:'post',
            headers: {'token': token},
            data:param
        })
    },
    getSubmissionResult:(param,token)=> {
        return request({
            url: '/exam/user/submit-log/get',
            method:'post',
            headers: {'token': token},
            params:{submissionId:param}
        })
    },
    getQSubmissionResult:(questionId,examId,token)=> {
        return request({
            url: '/exam/user/question/submit-log/get',
            method:'get',
            headers: {'token': token},
            params:{questionId:questionId,examId:examId}
        })
    },
}
